<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="/static/css/cart.css">
    <link rel="stylesheet" href="/static/css/base.css">
</head>

<body>
    <div class="header">
        购物车
        <p>
          <span class="on active"><a href="/pages/index">返回首页</a> <a href="/pages/list?current=1">返回商品列表</a></span>
        </p>
      </div>
      <div class="content cart">
        {{ if !list.length }}
        <div class="empty">
          <img src="https://img2.baidu.com/it/u=2281278719,4197881886&fm=253&fmt=auto&app=138&f=GIF?w=658&h=495" alt="">
        </div>
        {{ else }}
        <!-- 有内容的购物车 -->
        <div class="full" >
          <div class="top">
            <input class="select_all" type="checkbox" {{ selected === list.length ? 'checked' : '' }} > 全选
            
          </div>
          <ul>
            {{ each list }}
            <li>
              <div class="select" data-id="{{ $value.goodsID }}">
                <input {{ $value.is_select ? 'checked' : '' }} data-id="{{ $value.goodsID }}" class="select_item" type="checkbox">
              </div>
              <div class="show">
                <img  src="{{ $value.img }}">
              </div>
              <div class="title">
                 <span> {{ $value.title }} </span>
              </div>
              <div class="price">
                ￥ <span>{{ $value.price }}</span>
              </div>
              <div class="number">
                <button data-id="{{ $value.goodsID }}" class="item_sub">-</button>
                <input type="text" value="{{ $value.cart_number }}">
                <button data-id="{{ $value.goodsID }}" class="item_add">+</button>
              </div>
              <div class="sub">
                ￥ <span> {{ ($value.price * $value.cart_number).toFixed(2) }} </span>
              </div>
              <div class="destory">
                <button data-id="{{ $value.goodsID }}" class="item_del">删除</button>
              </div>
            </li> 
            {{ /each }}
          </ul>
          <div class="bottom">
            <p style="width: 120px;">总件数 : {{ selectNum }}  </p>
            <div class="btns">
              <button class="pay" {{ selected === 0 ? 'disabled' : '' }}  >去支付</button>
              <button class="clear_completed" {{ selected === 0 ? 'disabled' : '' }}  >删除所有已选中</button>
              <button class="clear">清空购物车</button>
            </div>
            <p style="width: 180px;">总价格 : ￥ <span> {{ selectPrice }} </span></p>
          </div>
      </div>
      {{ /if }}
      </div>
      <div class="footer">网页底部</div>
    <script src="/static/vander/jquery/jquery.min.js"></script>
    <script src="/static/js/cart.js"></script>
</body>
</html>